package br.ufms.cpcx.pitaco.util;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import br.ufms.cpcx.pitaco.model.Combo;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class ComboRest  {

    
	public ComboRest(String url) {
		super();
		this.url = url;
	}
	
	

	private String  url;
	
	public Combo getCombo(int idade,String acompanhado) throws Exception{
		Combo c = null;
		String[] resposta =  new WebServiceCliente().get(url+"id="+idade+"&ac="+acompanhado);
		if(resposta[0].equals("200")){
			GsonBuilder gbieder = new GsonBuilder();
			Gson g = gbieder.create();
			c = g.fromJson(resposta[1],Combo.class);
			return c;
		}else{
			throw new Exception(resposta[1]);
		}
		
	}



}




